#ifndef __FUNCTION_H__
#define __FUNCTION_H__

//与字符串相关的函数
void Rtrim(char *string);
void Ltrim(char *string);

//和日志，打印输出相关
void LogInit();
void LogStderr(int err, const char *fmt, ...);
void LogErrorCore(int level, int err, const char *fmt, ...);
u_char *LogErrno(u_char *buf, u_char *last, int err);
u_char *Snprintf(u_char *buf, size_t max, const char *fmt, ...);
u_char *Slprintf(u_char *buf, u_char *last, const char *fmt, ...);
u_char *Vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args);

//和设置进程标题相关
void InitSetProcTitle();
void SetProcTitle(const char *title);

//和信号/进程相关
int InitSignals();
void MasterProcessCycle();
int Daemon();
void ProcessEventsAndTimers();

#endif
